home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / Vk / VkGetResource.z / VkGetResource
Encoding:
Text File  |  2002-10-03  |  5.7 KB  |  133 lines

  1.  
  2.  
  3.  
  4. VVVVkkkkGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeee((((3333xxxx))))                                            VVVVkkkkGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeee((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      VkGetResource - Convenience functions for retrieving resources
  10.  
  11. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  12.      #include <Vk/VkResource.h>
  13.  
  14. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  15.            char * VkGetResource(const char *name,
  16.                                 const  char *className);
  17.  
  18.            XtPointer VkGetResource(Widget w,
  19.                                    const char *names,
  20.                                    const char *classNames,
  21.                                    const char *desiredType,
  22.                                    const char *defaultValue);
  23.  
  24.  
  25. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  26.           These functions provide simple ways to retrieve resources.  The
  27.           first form retrieves a resource by name and class name from the
  28.           application's resource database relative to the entire application.
  29.           The second form allows applications to retrieve a a resource
  30.           relative to a specific widget. The resource can be specified as a
  31.           dot-separated list of names and classes, allowing "virtual" sub-
  32.           resources to be retrieved.  The second form also allows a target
  33.           type to be specified.  VkGetResource will convert the retrieved
  34.           value, (or the default value if no value is retrieved), to the
  35.           specified type.
  36.  
  37. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  38.           Suppose an application wishes to draw an image and wishes to allow
  39.           the user to select various aspects of the style in which the image
  40.           is drawn. For example, each style might include a color and fill
  41.           pattern (a pixmap) with which it is drawn.  Each aspect of each
  42.           style could be specified as a resource which could be retrieved as
  43.           follows.
  44.  
  45.            Widget shell = XtAppInitialize(/* args */ );
  46.  
  47.            Widget canvas = XmCreateDrawingArea(shell, "canvas",
  48.                                                NULL, 0);
  49.  
  50.            Pixel fgOne = (Pixel) VkGetResource(canvas,
  51.                                          "styleOne.foreground",
  52.                                          "Style.Foreground",
  53.                                          XmRString, "Black");
  54.  
  55.            Pixel fgTwo = (Pixel) VkGetResource(canvas,
  56.                                          "styleTwo.foreground",
  57.                                          "Style.Foreground",
  58.                                           XmRString, "Black");
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. VVVVkkkkGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeee((((3333xxxx))))                                            VVVVkkkkGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeee((((3333xxxx))))
  71.  
  72.  
  73.  
  74.            Pixel fgThree = (Pixel) VkGetResource(canvas,
  75.                                           "styleThree.foreground",
  76.                                           "Style.Foreground",
  77.                                            XmRString, "Black");
  78.  
  79.            Pixel bgOne = (Pixel) VkGetResource(canvas,
  80.                                           "styleOne.background",
  81.                                           "Style.Background",
  82.                                            XmRString, "White");
  83.  
  84.            Pixel bgTwo = (Pixel) VkGetResource(canvas,
  85.                                           "styleTwo.background",
  86.                                           "Style.Background",
  87.                                           XmRString, "White");
  88.  
  89.            Pixel bgThree = (Pixel) VkGetResource(canvas,
  90.                                           "styleThree.background",
  91.                                           "Style.Background",
  92.                                            XmRString, "White");
  93.  
  94.            Pixmap pixOne = (Pixmap) VkGetResource(canvas,
  95.                                        "styleOne.pixmap",
  96.                                        "Style.Pixmap",
  97.                                        XmRString, "background");
  98.  
  99.            Pixmap pixTwo = (Pixmap) VkGetResource(canvas,
  100.                                        "styleTwo.pixmap",
  101.                                        "Style.Pixmap",
  102.                                        XmRString, "background");
  103.  
  104.            Pixmap pixThree = (Pixmap) VkGetResource(canvas,
  105.                                            "styleThree.pixmap",
  106.                                            "Style.Pixmap",
  107.                                            XmRString, "background");
  108.  
  109.      These calls attempt to load a resource by the complete resource
  110.      specification:
  111.  
  112.           shell.canvas.styleOne.foreground
  113.  
  114.      and so on. All of the usual wild card uses apply. Data returned by
  115.      VkGetResource() should not be freed.
  116.  
  117. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  118.      _V_i_e_w_K_i_t _P_r_o_g_r_a_m_m_e_r'_s _G_u_i_d_e
  119.      _T_h_e _X _W_i_n_d_o_w _S_y_s_t_e_m, DEC Press, Bob Sheifler and Jim Gettys
  120.      _T_h_e _X _W_i_n_d_o_w _S_y_s_t_e_m _T_o_o_l_k_i_t, DEC Press, Paul Asente and Ralph Swick
  121.      _T_h_e _O_S_F/_M_o_t_i_f _P_r_o_g_r_a_m_m_e_r_s _R_e_f_e_r_e_n_c_e, Prentice Hall, OSF
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.